import logging
import os
import pathlib

def setup_loggers(log_folder="logs"):
    """配置并返回多个日志记录器"""
    if not os.path.exists(log_folder):
        os.makedirs(log_folder)

    # 日志配置
    log_configs = [
        ("process_monitor.log", logging.INFO, 'process'),
        ("status_monitor.log", logging.INFO, 'status'),
        ("error_monitor.log", logging.ERROR, 'error')
    ]

    loggers = {}
    
    # 创建格式化器
    formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')

    for log_name, log_level, logger_name in log_configs:
        # 创建处理器
        handler = logging.FileHandler(
            os.path.join(log_folder, log_name), 
            encoding='utf-8'
        )
        handler.setLevel(log_level)
        handler.setFormatter(formatter)
        
        # 创建并配置logger
        logger = logging.getLogger(logger_name)
        logger.addHandler(handler)
        loggers[logger_name] = logger

    return loggers